<ion-header>
  <ion-navbar>
    <ion-title></ion-title>
  </ion-navbar>
</ion-header>

<ion-content>
  <div class="date_box">
    <button ion-button [color]="select_form.date == 'all' ? '' : 'light'" (tap)="checktime('all')">全部</button>
    <button ion-button [color]="select_form.date == 'month' ? '' : 'light'" (tap)="checktime('month')">近一月内</button>
    <button ion-button [color]="select_form.date == 'week' ? '' : 'light'" (tap)="checktime('week')">近一周内</button>
    <button ion-button [color]="select_form.date == 'day' ? '' : 'light'" (tap)="checktime('day')">近三天</button>
  </div>

  <div>
    <ion-item>
      <ion-label>状态</ion-label>
      <ion-select [(ngModel)]="select_form.display" okText="确定" cancelText="取消">
        <ion-option value="{{item.display}}" *ngFor="let item of statuslist">{{item.display}}</ion-option>
      </ion-select>
    </ion-item>
  </div>

  <div>
    <ion-item>
      <ion-label>类型</ion-label>
      <ion-select [(ngModel)]="select_form.type" okText="确定" cancelText="取消">
        <ion-option value="{{item.name}}" *ngFor="let item of alltype">{{item.name}}</ion-option>
      </ion-select>
    </ion-item>
  </div>

  <div>
    <ion-item>
      <ion-label>项目类型</ion-label>
      <ion-select [(ngModel)]="select_form.tasktype" okText="确定" cancelText="取消">
        <ion-option value="{{item.project}}" *ngFor="let item of projecttype">{{item.project}}</ion-option>
      </ion-select>
    </ion-item>
  </div>

  <div>
    <ion-item>
      <ion-label>姓名</ion-label>
      <ion-select [(ngModel)]="select_form.name" okText="确定" cancelText="取消">
        <ion-option value="{{item.name}}" *ngFor="let item of receiveuser">{{item.name}}</ion-option>
      </ion-select>
    </ion-item>
  </div>

  <button ion-button block (tap)="filterItem()">确定筛选</button>


  <ion-list>
    <ion-item-sliding *ngFor="let item of list">
      <ion-item (tap)="goTaskDetail(item.id,item.classname)">
        <em *ngIf="item.state != '已完成'">{{item.level}}</em>
        <ion-avatar item-start>{{item.receiveuser.slice(-2)}}</ion-avatar>
        <h2>{{item.title}}</h2>
        <p><span [class]="item.classname">{{item.state}}</span></p>
        <ion-note item-end>
          <span>{{item.createtime}}</span>
        </ion-note>
      </ion-item>
      <ion-item-options side="right">
        <button *ngIf="item.classname == 'receive_state'" ion-button (tap)="modifyTask(item.state,item.createuser,item.id)">修改</button>
        <button
          *ngIf="item.classname == 'receive_state'"
          ion-button color="secondary"
          (tap)="remindTask(item.state,item.createuser,item.id)">提醒</button>
        <button
          *ngIf="item.classname == 'receive_state'"
          ion-button color="danger"
          (tap)="revokeTask(item.state,item.createuser,item.id)">撤销</button>
      </ion-item-options>
    </ion-item-sliding>
    <!--<ion-item-sliding *ngFor="let item of list">-->
      <!--<ion-item>-->
        <!--<ion-grid class="task_list" (tap)="goTaskDetail(item.id,item.classname)">-->
          <!--<ion-row>-->
            <!--<ion-col>-->
              <!--<span [class]="item.classname">{{item.state}}</span>-->
              <!--<i class="receiveuser">{{item.receiveuser}}</i>-->
              <!--<em>{{item.level}}</em>-->
            <!--</ion-col>-->
          <!--</ion-row>-->
          <!--<ion-row align-items-center style="margin:10px 0;">-->
            <!--<ion-col class="title">{{item.title}}</ion-col>-->
            <!--<ion-col col-3>{{item.createtime}}</ion-col>-->
          <!--</ion-row>-->
        <!--</ion-grid>-->
      <!--</ion-item>-->
      <!--<ion-item-options>-->
        <!--<button class="modify_btn" ion-button (tap)="modifyTask(item.state,item.createuser,item.id)">修改</button>-->
      <!--</ion-item-options>-->
    <!--</ion-item-sliding>-->
    <div *ngIf="noMoreArticleTip"><p style="text-align:center;">没有更多数据了</p></div>
  </ion-list>

  <ion-infinite-scroll *ngIf="select_form.token != ''" (ionInfinite)="doInfinite($event)" immediate-check="false" threshold="50px">
    <ion-infinite-scroll-content
      loadingSpinner="bubbles"
      loadingText="加载更多内容中...">
    </ion-infinite-scroll-content>
  </ion-infinite-scroll>

</ion-content>
